package com.wisemoresystem.seal.action.seal.check;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.wisemoresystem.seal.base.action.ProjBaseAction;
import com.wisemoresystem.seal.service.BankService;
import com.wisemoresystem.seal.service.SealSetService;
import com.wisemoresystem.seal.util.json.JsonTools;

@Controller("ixSealCheck")
@Scope("prototype")
@RequestMapping("/ix/seal/set")
public class SealCheckAction extends ProjBaseAction {

	@Autowired
	private SealSetService sealService;
	@Autowired
	private BankService bService;
	/**
	 * 机构树
	 * @param bank_id 机构id
	 * @return
	 */
	@RequestMapping("/tree")
	public ModelAndView tree(String bank_id) {

		List<Map<String, Object>> list = bService.selectUserBank();
		String bankJson = JsonTools.toJson(list);

		ModelAndView mv = new ModelAndView("/jsp/seal/set/tree");
		mv.addObject("bankJson", bankJson);
		mv.addObject("bank_id", bank_id);
		return mv;
	}
	/**
	 * 印章列表
	 * @param srh_name
	 * @param bank_id 机构id
	 * @return
	 */
	@RequestMapping("/list2")
	public ModelAndView list2(String srh_name, String bank_id) {

		List<Map<String, Object>> list = sealService.selectSealUserList(
				srh_name, bank_id, page);

		ModelAndView mv = new ModelAndView("/jsp/seal/set/list2");
		mv.addObject("list", list);
		mv.addObject("bank_id", bank_id);
		return mv;
	}

}
